package com.hhd.flow.engine.vo;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class Gateway {
    private String id;
    private String type;
    private ExecuteWay executeWay;
    private boolean start; //是否是开始网关
    private boolean end; //是否是结束网关

    public Gateway getEndGateway(FlowModel flowModel) {
        for (GatewayPair gatewayPair : flowModel.getGatewayPairs()) {
            if (gatewayPair.getSource().equals(this.id)) {
                return flowModel.getGatewaById(gatewayPair.getTarget());
            }
        }
        return null;
    }


    public enum ExecuteWay {
        include, exclusive
    }
}
